<script setup lang="ts">
interface Props {
  title?: string
}

const props = defineProps<Props>()
</script>

<template>
  <div class="stat-box-chart">
    <div v-if="props.title" class="title-container">
      <div class="title-box">
        <div class="title-icon"></div>
        <div class="title-text">{{ props.title }}</div>
      </div>
      <div class="toolbar-container">
        <slot name="toolbar"></slot>
      </div>
    </div>
    <div class="content-container">
      <slot></slot>
    </div>
  </div>
</template>

<style lang="scss" scoped>
.stat-box-chart {
  @include flex(column, flex-start, flex-start);
  box-sizing: border-box;
  background: #ffffff;
  border-radius: 10px;
  padding: 16px;
  position: relative;
  .title-container {
    @include flex(row, space-between, center);
    width: 100%;
    margin-bottom: 16px;
    .title-box {
      @include flex(row, flex-start, center);
      .title-icon {
        @include rect(3px, 16px);
        background: var(--theme-color);
        margin-right: 8px;
      }
      .title-text {
        font-family: 'PingFangSC-Regular';
        font-size: 16px;
        font-weight: bold;
      }
    }
  }
  .content-container {
    box-sizing: border-box;
    width: 99%;
    flex: 1;
  }
}
</style>
